<?php

class ActiveRecord extends CActiveRecord
{
	public function getIterator()
	{
		$attributes = $this->getAttributes();
		$relations = array();
		                
		foreach ($this->relations() as $key => $related)
		{
			if ($this->hasRelated($key))
			{
				$relations[$key] = $this->$key;
			}
		}
		$all = array_merge($attributes, $relations);
		return new CMapIterator($all);
	}
}